package com.weishe.hive;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;


public class PagePvHive  {


	public static void main(String[] args) {
		Connection conn=null;
		try {
			conn=Util.getConn();
			Statement st =conn.createStatement();
			st.execute("add jar /root/getPageId.jar");
			String sql ="create temporary function getpageid as 'com.bjsxt.hive.GetPageID' ";
			st.execute(sql);
			st.execute("drop table tmp_page_pv_uv1");
			sql="create table tmp_page_pv_uv1 as select getpageid(url) page_id,count(session_id) pv,count(distinct session_id) uv from trackinfo where ds='20150713' group by getpageid(url)";
			st.execute(sql);
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			
		}
		
		
	}
}
